var t = require("../../@babel/runtime/helpers/defineProperty"),
  a = require("../../res/www.a9a.cn.js"),
  e = getApp(),
  n = wx.getStorageSync("COOK_U");
Page({
  data: {
    topbar: ["我发起的", "收到请求", "互换成功"],
    currentTab: 0,
    LIST_index: 0,
  },
  topbarFn: function (t) {
    var a = parseInt(t.currentTarget.dataset.idx);
    this.setData({ currentTab: a }), this.get_data(a + 1);
  },
  onLoad: function (t) {
    var n = t.t;
    (n = a.empty(n) ? 1 : n), this.setData({ currentTab: n - 1 });
    var i = this;
    e.chklogin().then(function (t) {
      t || wx.navigateBack();
    }),
      e.get_openid().then(function (t) {
        i.setData({ color: e._ZEAI.color, rgbcolor: a.c16_rgb(e._ZEAI.color) }),
          i.get_data(n);
      });
  },
  get_data: function (t) {
    var a = this;
    (n = wx.getStorageSync("COOK_U")),
      e.ajax({
        url: "my_hh.php",
        data: { submitok: "list", t: t, openid: n.openid },
        success: function (t) {
          1 == t.flag
            ? a.setData({ LIST: t.LIST, MY: t.MY })
            : wx.showModal({
                content: t.msg,
                confirmColor: a.data.color,
                confirmText: "朕知道了",
                showCancel: !1,
                success: function (t) {
                  wx.navigateBack();
                },
              });
        },
      });
  },
  uFn: function (t) {
    var a = t.currentTarget.dataset.uid;
    wx.navigateTo({ url: "../u/u?uid=" + a });
  },
  copyFn: function (t) {
    var e = t.currentTarget.dataset.content,
      n = t.currentTarget.dataset.kind_str;
    a.copy_text({ data: e, msg: n + "复制成功" });
  },
  agreeFn: function (t) {
    var a = t.currentTarget.dataset.uid,
      e = t.currentTarget.dataset.kind,
      n = t.currentTarget.dataset.list_index,
      i = "weixin" == e ? "微信号" : "手机号";
    this.setData({
      mask_class: "alpha0_100",
      div_hh_box: !0,
      hh_title: i,
      hh_kind: e,
      hh_uid: a,
      list_index: n,
    });
  },
  passFn: function (a) {
    var i = a.currentTarget.dataset.uid,
      s = a.currentTarget.dataset.kind,
      r = a.currentTarget.dataset.list_index,
      o = "weixin" == s ? "微信号" : "手机号",
      c = this;
    wx.showModal({
      title: "拒绝互换",
      content: "缘份就在一瞬间\n\n确定要【拒绝】互换" + o + "么？",
      confirmColor: c.data.color,
      cancelText: "取消",
      confirmText: "确定",
      success: function (a) {
        a.confirm &&
          e.ajax({
            url: "my_hh.php",
            data: { submitok: "ajax_pass", kind: s, uid: i, openid: n.openid },
            success: function (a) {
              var e;
              1 == a.flag
                ? c.setData(
                    (t((e = {}), "LIST[" + r + "].ifagree", 2),
                    t(e, "LIST[" + r + "].class", "pass"),
                    t(e, "LIST[" + r + "].flag_str", "已拒绝"),
                    e)
                  )
                : wx.showToast({
                    title: a.msg,
                    icon: "none",
                    mask: !0,
                    duration: 4e3,
                  });
            },
          });
      },
    });
  },
  hh_submitFn: function (i) {
    var s = i.currentTarget.dataset.hh_uid,
      r = i.currentTarget.dataset.hh_kind,
      o = i.detail.value.content,
      c = "weixin" == r ? "微信号" : "手机号",
      u = this;
    a.empty(o)
      ? wx.showToast({ title: "请输入【" + c + "】", icon: "none", mask: !0 })
      : "mob" != r || a.ifmob(o)
      ? (this.setData({ div_hh_box: !1, hh_title: c }),
        e.ajax({
          url: "my_hh.php",
          data: {
            submitok: "ajax_hh_update",
            content: o,
            kind: r,
            uid: s,
            openid: n.openid,
          },
          success: function (e) {
            if (1 == e.flag) {
              var n,
                i = u.data.list_index;
              u.setData(
                ((n = {
                  HH: e.HH,
                  mask_class: "alpha0_100",
                  div_hh_success: !0,
                }),
                t(n, "LIST[" + i + "].ifagree", 1),
                t(n, "LIST[" + i + "].class", "success"),
                t(n, "LIST[" + i + "].flag_str", "互换成功"),
                n)
              );
            } else (e.this = u), a.sorry(e);
          },
        }))
      : wx.showToast({
          title: "请输入正确的【" + c + "】",
          icon: "none",
          mask: !0,
        });
  },
  certFn: function () {
    var t = this;
    e.chklogin().then(function (a) {
      a ? wx.navigateTo({ url: "../my/cert" }) : t.setData({ div_login: !0 });
    });
  },
  vipFn: function () {
    var t = this;
    e.chklogin().then(function (a) {
      a
        ? wx.navigateTo({ url: "../my_vip/my_vip" })
        : t.setData({ div_login: !0 });
    });
  },
  dataFn: function () {
    var t = this;
    e.chklogin().then(function (a) {
      a ? wx.navigateTo({ url: "../reg/reg" }) : t.setData({ div_login: !0 });
    });
  },
  mask_closeFn: function (a) {
    var e = this,
      n = a.currentTarget.dataset.maskid;
    this.setData({ mask_class: "alpha100_0" }),
      setTimeout(function () {
        e.setData(t({}, n, !1));
      }, 500);
  },
});
